package com.gc.services.impl;

import com.gc.dao.custom.TemplateMapper;
import com.gc.pojo.SysTemplate;
import com.gc.services.TemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TemplateServiceImpl implements TemplateService {

    @Autowired
    private TemplateMapper templateMapper;

    @Override
    public List<SysTemplate> getAll() {
        return templateMapper.selectAll();
    }

    @Override
    public SysTemplate getTemplateByTId(Integer tid) {
        return templateMapper.selectByPrimaryKey(tid);
    }

    @Override
    public int addTemplate(SysTemplate template) {
        return templateMapper.insert(template);
    }

    @Override
    public int removeTemplateByTId(Integer tid) {
        return templateMapper.deleteByPrimaryKey(tid);
    }

    @Override
    public SysTemplate getTemplateByUserId(Integer userId) {
        return templateMapper.selectByUserId(userId);
    }

    @Override
    public SysTemplate getTemplateByClientId(Integer clientId) {
        return templateMapper.selectByClientId(clientId);
    }

}
